/* GUI CONVERTED from eciq15.p (converter v1.75) Mon Aug 14 12:26:58 2000 */
/* eciq15.p - PCC ROUTING FILE INQUIRY                                  */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*K0FG*/ /*V8:ConvertMode=Report                                        */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                 */
/* REVISION: 8.6      LAST MODIFIED: 06/27/97   BY: Joe Gawel    *K0FG* */
/* REVISION: 8.6      LAST MODIFIED: 06/27/97   BY: Joe Gawel    *K0F4* */


/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan   */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan   */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/14/00 BY: *N0KW* Jacolyn Neder    */

/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

        {mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE eciq15_p_1 "Comments"
/* MaxLen: Comment: */

&SCOPED-DEFINE eciq15_p_2 "Run Time/Batch Qty"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

/*K0F4*  THE INCLUDE FILES USED FOR THIS PATCH (ECRODEF.I, ECROGET.I    */
/*K0F4*  AND ECROPUT.I) SHOULD BE REMOVED ONCE THE NEW FIELDS HAVE BEEN */
/*K0F4*  ADDED TO THE ECD2_DET TABLE IN THE SCHEMA.                     */

/*K0F4*/ {ecrodef.i}  /* ECD2_DET SIDEFILE DEFINITIONS */

        define input parameter ecm_recid as recid.
        define input parameter prog_type as character.
        define input parameter inq_yn    as logical.
        define input parameter dmpld     like mfc_logical.
        define input parameter mstrfile  like mfc_logical.
        define output parameter msgnbr   like msg_nbr initial 0.
        define output parameter warnlvl  as integer initial 0.

        define variable comments         like mfc_logical
                                         label {&eciq15_p_1} no-undo.
        define variable ecd2routing      like ecd2_routing no-undo.
        define variable ecd2op           like ecd2_op no-undo.
/*K0F4*/define variable batch_qty        like pt_batch no-undo.
/*K0F4*/define variable um               like bom_batch_um no-undo.
/*K0F4*/define variable runtime_per_batch like ro_run
/*K0F4*/                label {&eciq15_p_2}
/*K0F4*/                format ">>>>>>>>9.9<<<<<<<<" no-undo.

        define shared workfile ecmmstr   like ecm_mstr.
        define shared workfile ecd2det   like ecd2_det.
/*K0F4*/define shared workfile qadwkfl   like qad_wkfl.
        define shared workfile cmtdet    like cmt_det.
        define shared variable error_msg as character
                                         format "x(60)" extent 10.

/*K0F4* do for ecmmstr,ecd2det,cmtdet:  */
/*K0F4*/do for ecmmstr,ecd2det,qadwkfl,cmtdet:

           /* DISPLAY SELECTION FORM */
           FORM /*GUI*/ 
           {ecform15.i}
           with STREAM-IO /*GUI*/  frame form15 attr-space side-labels width 80.

           /* SET EXTERNAL LABELS */
           setFrameLabels(frame form15:handle).

           find first ecmmstr where recid(ecmmstr) = ecm_recid no-lock no-error.
           if not available (ecmmstr) then return.

           find first ecd2det where ecd2_nbr = ecm_nbr no-error.
           if available ecd2det then page.

           for each ecd2det where ecd2_nbr = ecm_nbr no-lock with frame form15:

/*K0F4*/      batch_qty = 0.
/*K0F4*/      um = "".

              find first pt_mstr where pt_part = ecd2_routing no-lock no-error.
              if available pt_mstr then display pt_desc1 with frame form15 STREAM-IO /*GUI*/ .
              else display "" @ pt_desc1 with frame form15 STREAM-IO /*GUI*/ .
              find first wc_mstr where wc_wkctr = ecd2_wkctr and wc_mch = ecd2_mch
              no-lock no-error.
              if available wc_mstr then display wc_desc with frame form15 STREAM-IO /*GUI*/ .
              else display "" @ wc_desc with frame form15 STREAM-IO /*GUI*/ .

/*K0F4*/      find first qadwkfl where qadwkfl.qad_key1 = "ecd2_det"
/*K0F4*/      and qadwkfl.qad_key2 = string((ecd2_nbr),"x(24)")
/*K0F4*/                           + string((ecd2_routing),"x(18)")
/*K0F4*/                           + string((string(ecd2_op)),"x(5)")
/*K0F4*/      no-lock no-error.
/*K0F4*/      if available qadwkfl then do:
/*K0F4*/        assign
/*K0F4*/          ecd2_milestone    = (if qadwkfl.qad_charfld[1] = "Yes" then yes else no)
/*K0F4*/          ecd2_tran_qty     = integer(qadwkfl.qad_decfld[1])
/*K0F4*/          ecd2_sub_lead     = integer(qadwkfl.qad_decfld[2])
/*K0F4*/          ecd2_queue        = qadwkfl.qad_decfld[3]
/*K0F4*/          ecd2_wait         = qadwkfl.qad_decfld[4]
/*K0F4*/          ecd2_move         = qadwkfl.qad_decfld[5]
/*K0F4*/          ecd2_inv_value    = qadwkfl.qad_decfld[6]
/*K0F4*/          ecd2_mv_nxt_op    = (if qadwkfl.qad_charfld[2] = "Yes" then yes else no)
/*K0F4*/          ecd2_wipmtl_part  = qadwkfl.qad_charfld[3]
/*K0F4*/          ecd2_po_nbr       = qadwkfl.qad_charfld[4]
/*K0F4*/          ecd2_po_line      = integer(qadwkfl.qad_decfld[7])
/*K0F4*/          ecd2_cyc_rate     = qadwkfl.qad_decfld[8]
/*K0F4*/          ecd2_auto_lbr     = (if qadwkfl.qad_charfld[5] = "Yes" then yes else no).
/*K0F4*/      end.
/*K0F4*/      else do:
/*K0F4*/        assign
/*K0F4*/          ecd2_milestone    = yes
/*K0F4*/          ecd2_tran_qty     = 0
/*K0F4*/          ecd2_sub_lead     = 0
/*K0F4*/          ecd2_queue        = 0
/*K0F4*/          ecd2_wait         = 0
/*K0F4*/          ecd2_move         = 0
/*K0F4*/          ecd2_inv_value    = 0
/*K0F4*/          ecd2_mv_nxt_op    = no
/*K0F4*/          ecd2_wipmtl_part  = ""
/*K0F4*/          ecd2_po_nbr       = ""
/*K0F4*/          ecd2_po_line      = 0
/*K0F4*/          ecd2_cyc_rate     = 0
/*K0F4*/          ecd2_auto_lbr     = no.
/*K0F4*/      end.

/*K0F4*/      find bom_mstr no-lock where bom_parent = ecd2_routing no-error.
/*K0F4*/      if available bom_mstr then do:
/*K0F4*/         batch_qty = bom_batch.
/*K0F4*/         um = bom_batch_um.
/*K0F4*/      end.
/*K0F4*/      else do:
/*K0F4*/          find pt_mstr where pt_part = ecd2_routing no-lock
/*K0F4*/               no-error.
/*K0F4*/          if available pt_mstr then do:
/*K0F4*/             if pt_bom_code = ""
/*K0F4*/                then
/*K0F4*/                   find bom_mstr no-lock where bom_parent = pt_part
/*K0F4*/                        no-error.
/*K0F4*/                else
/*K0F4*/                   find bom_mstr no-lock
/*K0F4*/                        where bom_parent = pt_bom_code
/*K0F4*/                        no-error.
/*K0F4*/             if available bom_mstr then do:
/*K0F4*/                batch_qty = bom_batch.
/*K0F4*/                um = bom_batch_um.
/*K0F4*/             end.
/*K0F4*/             else do:
/*K0F4*/                um = pt_um.
/*K0F4*/             end.
/*K0F4*/          end.
/*K0F4*/       end.

/*!K0F4*** REPLACED FOLLOWING DISPLAY ***
 *            display
 *              ecd2_routing @ ecd2routing
 *              ecd2_op @ ecd2op
 *              ecd2_desc
 *              ecd2_std_op
 *              ecd2_wkctr
 *              ecd2_mch_op
 *              ecd2_men_mch
 *              edcd2_batch
 *              ecd2_run_per_b
 *              ecd2_subcntrt
 *              ecd2_sub_cost
 *              ecd2_setup_men
 *              ecd2_yield_pct
 *              ecd2_setup
 *              ecd2_run
 *              ecd2_tool
 *              ecd2_vend
 *              ecd2__qad01
 *              (if ecd2_cmtindx <> 0 then yes else no) @ comments
 *           with frame form15.
 *!K0F4*** END OF REPLACED DISPLAY ****/

 /*K0F4***** NEW DISPLAY STATEMENT *******/
               display
                 ecd2routing
                 ecd2op
                 batch_qty
                 um
                 ecd2__qad01
                 ecd2_std_op
                 ecd2_wkctr
                 ecd2_mch
                 ecd2_desc
                 ecd2_mch_op
                 ecd2_milestone
                 ecd2_tran_qty
                 ecd2_sub_lead
                 ecd2_queue
                 ecd2_setup_men
                 ecd2_wait
                 ecd2_men_mch
                 ecd2_setup
                 ecd2_tool
                 ecd2_run * batch_qty @ runtime_per_batch
                 ecd2_run
                 ecd2_vend
                 ecd2_move
                 ecd2_inv_value
                 ecd2_yield_pct
                 ecd2_sub_cost
                 (if ecd2_cmtindx <> 0 then yes else no) @ comments
               with frame form15 STREAM-IO /*GUI*/ .
/*K0F4*** END OF NEW DISPLAY *******/

             if not dmpld then do:
               if not mstrfile then put error_msg[6].

               else if can-find(ecd2_det where
               ecd2_det.ecd2_nbr = ecd2det.ecd2_nbr and
               ecd2_det.ecd2_routing = ecd2det.ecd2_routing and
               ecd2_det.ecd2_op = ecd2det.ecd2_op)
               then put error_msg[1].

             end.
             down.

             if ecd2_cmtindx <> 0 then do:
                 for each cmtdet no-lock where cmt_indx = ecd2_cmtindx
                 with frame ecdc attr-space side-labels width 80 row 10  overlay:
                    FORM /*GUI*/  cmt_seq skip
                         cmt_cmmt[1] no-label
                         cmt_cmmt[2] no-label
                         cmt_cmmt[3] no-label
                         cmt_cmmt[4] no-label
                         cmt_cmmt[5] no-label
                         cmt_cmmt[6] no-label
                         cmt_cmmt[7] no-label
                         cmt_cmmt[8] no-label
                    with STREAM-IO /*GUI*/  frame ecdc width 80.

                    /* SET EXTERNAL LABELS */
                    setFrameLabels(frame ecdc:handle).
                    display cmt_seq + 1 @ cmt_seq
                    cmt_cmmt[1 for 8] no-label with frame ecdc STREAM-IO /*GUI*/ .
                    down.

                    if cmt_cmmt[9] + cmt_cmmt[10] + cmt_cmmt[11] + cmt_cmmt[12]
                    + cmt_cmmt[13] + cmt_cmmt[14] + cmt_cmmt[15] <> ""
                    then do with frame ecdc:
                       display cmt_seq + 1 @ cmt_seq
                       cmt_cmmt[9]  @ cmt_cmmt[1]
                       cmt_cmmt[10] @ cmt_cmmt[2]
                       cmt_cmmt[11] @ cmt_cmmt[3]
                       cmt_cmmt[12] @ cmt_cmmt[4]
                       cmt_cmmt[13] @ cmt_cmmt[5]
                       cmt_cmmt[14] @ cmt_cmmt[6]
                       cmt_cmmt[15] @ cmt_cmmt[7]
                       with frame ecdc STREAM-IO /*GUI*/ .
                       down.
                    end.

                    if not dmpld then do:
                       if not mstrfile then put error_msg[6].
                    end.

                    down.
                    
/*GUI*/ {mfguichk.i  &warn=false} /*Replace mfrpchk*/

                 end.  /* FOR EACH CMTDET */
                 hide frame ecdc.
               end.    /* IF ECD2_CMTINDX */
              
/*GUI*/ {mfguichk.i  &warn=false} /*Replace mfrpchk*/

           end.        /* FOR EACH ECD2DET */
        end.           /* DO FOR ECMMSTR, ECD2DET, CMTDET */
